package com.taojiazheng.daoImpl.job;

import com.sun.scenario.effect.impl.prism.PrImage;
import com.taojiazheng.dao.job.JobDao;
import com.taojiazheng.entity.Job;
import com.taojiazheng.entity.Jobinfo;
import com.taojiazheng.entity.Mycreate;
import com.taojiazheng.mapper.JobMapper;
import com.taojiazheng.mapper.JobinfoMapper;
import com.taojiazheng.mapper.MycreateMapper;
import com.taojiazheng.so.job.JobSo;
import com.taojiazheng.vo.job.JobInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author 赵成林
 * @date 2017/11/23 14:36
 */
@Repository
public class JobDaoImpl implements JobDao {
    @Autowired
    private JobMapper jobMapper;
    @Autowired
    private JobinfoMapper jobinfoMapper;
    @Autowired
    private MycreateMapper mycreateMapper;

    public int createJob(Job job) {
        int id  = jobMapper.insert(job);
        return job.getId();
    }

    public int createJobInfo(Jobinfo jobinfo) {
        return jobinfoMapper.insert(jobinfo);
    }

    public int myCreate(Mycreate mycreate) {
        return mycreateMapper.insert(mycreate);
    }

    public List<Jobinfo> getJoBList(Integer jobType) {
        //return null;
        return jobinfoMapper.getJobList(jobType);
    }

    public JobInfoVo getJobInfo(Integer jobId) {
        return jobinfoMapper.getJobInfo(jobId);
    }

    /**
     * 更新浏览人数
     */
    public int updateVisitNum(Map map) {
        return jobinfoMapper.upsetVisitNum(map);
    }

    public int updateUrl(Map map) {
        return jobMapper.updateUrl(map);
    }

    public int updateJobInfoUrl(Map map) {
        //return 0;
        return jobinfoMapper.updateUrl(map);
    }
}
